﻿@model HanGu.Entity.Message
@{
    Layout = null;
    TempData["Remark"] = Model.Remark;
    var Attachments = ViewData["Attachments"] as List<HanGu.Entity.FileManage> ?? new List<HanGu.Entity.FileManage>();
}
<div class="pageContent">
    <style>
        #FileInputUploader
        {
            padding-left: 130px;
        }
    </style>
    <script>
        function onallcomplete(event, id, fileObj, response, data) {


        }
        function uploadifyComplete(event, queueId, fileObj, response, data) {
            var html = "<div class='uploadedFile'>" + fileObj.name + "</div>";
            $("#uploadedFile").html($("#uploadedFile").html() + html);
            DWZ.ajaxDone(DWZ.jsonEval(response));

        }


    </script>
    <form method="post" action="admin/@ViewData["CurrentController"]/Email"  enctype="MULTIPART/FORM-DATA" class="pageForm required-validate"
    onsubmit="return iframeCallback(this, navTabAjaxDone);">
    @Html.ValidationSummary(true)
    <div class="pageFormContent" layouth="56">
        @Html.HiddenFor(model => model.ID)
        @Html.HiddenFor(model => model.Type)
        @Html.Hidden("Email.MemberID", Model.MemberID)
        @Html.HiddenFor(model => model.CreateTime)
        @Html.HiddenFor(model => model.Creator)
        @Html.HiddenFor(model => model.GUID)
        <p style="width: 100%;height:60px">
            <label>
                接收组：</label>
            @Html.TextArea("Email.Receiver", Model.Receiver, new { @class = "required", style = "width:600px;height:50px" })
            <a class="btnLook" href="admin/Group/Selecter?lookup=Email" lookupGroup="Email">选择会员</a>
            @Html.ValidationMessageFor(model => model.Receiver)
        </p>
        <p style="width: 100%">
            <label>
                标题：</label>
            @Html.TextBoxFor(model => model.Title, new { @class = "required", style = "width:400px" })
            @Html.ValidationMessageFor(model => model.Receiver)
        </p>
        @if (Request["action"] != "view")
        {
        <label>
            附件：
        </label>
        
        <div id="fileQueue" class="fileQueue">
        </div>
        <input id="FileInput" type="file" name="image" uploader="/Content/uploadify/scripts/uploadify.swf"
            cancelimg="Content/uploadify/cancel.png" script="admin/FileManage/SaveFiles" scriptdata="{ClassType:'Temp', guid:'@Model.GUID',GroupName:''}"
            filequeue="fileQueue" onallcomplete="uploadifyComplete" fileExt="*.*" fileDesc="*.*"/>
        }
       <div class="divider"></div>
       <p>
       <label>已上传附件：</label>
        <div id="uploadedFile" style=" margin-left:130px">
        @if (Attachments != null && Attachments.Count > 0)
        {
            foreach (var item in Attachments)
            { 
            <div><a href="@item.FilePath" target="_blank">@item.FilePath</a></div>
            }
        }
        </div>
       </p>
        <p style="width: 100%; height: 200px">
            <label>
                内容：</label>
            @Html.Partial("Editor", new HanGu.Entity.EditorDTO() { CrontrollID = "Remark", Value = Model.Remark })
            @Html.ValidationMessageFor(model => model.Remark)
        </p>
    </div>
    @if (Request["action"] != "view")
    {
    <div class="formBar">
        <ul>
            <li>
                <div class="buttonActive">
                    <div class="buttonContent">
                        <button type="submit">
                            提交</button></div>
                </div>
            </li>
            <li>
                <div class="button">
                    <div class="buttonContent">
                        <button type="button" class="close">
                            取消</button></div>
                </div>
            </li>
        </ul>
    </div>
    }
    </form>
</div>
